home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / MacOS / QuickDraw™ 3D 1.0.6F4 SDK / Samples / SampleCode / Tumbler and Podium / Tumbler_document.h < prev    next >
Encoding:
Text File  |  1995-05-31  |  4.0 KB  |  120 lines  |  [TEXT/MPS ]

  1. // Tumbler_Document.h
  2. //
  3. // Document related data structures and function prototypes for the 
  4. // document type used in the Tumbler application
  5. //
  6. // Modification History
  7. //
  8. //    11/26/94        nick        initial cut - symantec proto_helper app, add defines
  9. //                                and strip stuff from the globals.h file
  10. //    01/24/95        nick        add field for backfacing style
  11.  
  12. #ifndef _Tumbler_DOCUMENT_H_
  13. #define _Tumbler_DOCUMENT_H_
  14.  
  15.  
  16. #include "Tumbler_Offscreen.h"
  17.  
  18. //    Data Structures.
  19.  
  20. typedef struct WindowOffscreen {
  21.     CGrafPtr        windowPort;
  22.     GDHandle        windowDevice;
  23.     GWorldPtr        offscreenWorld;
  24. } WindowOffscreen;
  25.  
  26. //    Data Structures.
  27.  
  28.  
  29. #define    kTumblerDefaultClearColor    0.8
  30.  
  31. typedef struct _DocumentRecord {
  32.     WindowPtr                theWindow;
  33.     FSSpec                    theFileSpec ;
  34.     short                    fRefNum;
  35.     short                    dirty;
  36.     
  37. #ifdef PODIUM_APP
  38.     // the main difference between Tumbler and podium is that 
  39.     // podium has a background picture that is displayed behind
  40.     // the group, and that the group uses a pixmap draw context
  41.     // which is variable sized and "floats" above the background 
  42.     // picture.  To make this work, we need 2 extra GWorlds, one
  43.     // for the BG picture and one to attach to the pixmap draw 
  44.     // context
  45.     
  46.     GWorldPtr                bgOffscreen ;            // holds a pict the size of the main window.
  47.     GWorldPtr                screenBuffer ;            // use for compositing to reduce flicker
  48.                                                     // same size as the above.
  49.                                                     
  50.     GWorldPtr                geometriesOffscreen ;    // initially a 200x200 offscreen for the geo's.
  51. //    GWorldPtr                maskOffscreen ;            // same size as geo's - 1 bit mask.
  52.  
  53.     Rect                    bgRect ;                //
  54.     Rect                    dropArea;
  55.     GWorldPtr                drawContextOffscreen;
  56.     Point                    mouseLocation;
  57.     TQ3Object                currentlySelectedObject;
  58.     TQ3Boolean                selected;
  59.  
  60. #else
  61.     TQ3ColorARGB            clearColor ;
  62. #endif
  63.  
  64.  
  65.     TQ3GroupObject            documentGroup;                                // main group for the document
  66.     TQ3ViewObject            theView;                                    // the documents view object
  67.     TQ3Boolean                animateLights, animateModel;                // set to true if we are animating either the lights or the model
  68.     TQ3Boolean                light;                                        // set to true if the three lights are on
  69.     TQ3Boolean                shaded;                                        // we provide flat, per vertext or per pixel
  70.     TQ3GroupObject            dynamicLights;                                // the lighting for the scene
  71.     TQ3GroupObject            light1, light2, light3;                        // these objects indicate where the lights are (i.e. they are not the lights, but
  72.                                                                         // they indicate the location of the lights
  73.     TQ3TransformObject        lightXform1, lightXform2, lightXform3;        // transforms for the lights (used to map to their current position)
  74.     TQ3Matrix4x4            modelRotation;                                // the transform for the model
  75.     TQ3InterpolationStyle    currentInterpolation;
  76.     
  77.     TQ3StyleObject            backfacingStyle ;                            // the style to use for backface removal
  78.     TQ3ShaderObject            illuminationShader ;
  79.  
  80.     TQ3Point3D                documentGroupCenter;
  81.  
  82.     float                    documentGroupScale;
  83.     
  84.     TQ3SharedObject            viewHints;                                    // ViewHints for this doc
  85.  
  86.     TQ3Vector3D                rotationDir;
  87. } DocumentRecord, *DocumentPtr, **DocumentHandle ;
  88.  
  89. /* Tumbler_offscreen.c */
  90. TQ3Status DrawOffscreen(DocumentPtr theDocument);
  91. void DrawOnscreen(DocumentPtr theDocument);
  92.  
  93.  
  94. // Tumbler_document.c 
  95. void         AdjustDocumentView(DocumentPtr theDocument);
  96. void         AdjustScrollBar(DocumentPtr theDocument);
  97. void         PositionDocumentParts(DocumentPtr theDocument);
  98.  
  99. DocumentPtr NewDocument( TQ3SharedObject viewHints, TQ3GroupObject group );
  100.  
  101. Boolean     CloseDocument(DocumentPtr theDocument);
  102. Boolean     CloseAllDocuments(void);
  103.  
  104. void         DoActivateDocument(DocumentPtr theDocument, short activate);
  105. DocumentPtr GetDocumentFromWindow(WindowPtr theWindow);
  106.  
  107. TQ3Status InitializeGroup(TQ3GroupObject group);
  108.  
  109.  
  110. TQ3Status             TumblerDocument_NewLights( DocumentPtr theDocument ) ;
  111. TQ3CameraObject         TumblerDocument_NewCamera(WindowPtr theWindow);
  112. TQ3DrawContextObject    TumblerDocument_NewDrawContext(WindowPtr theWindow);
  113. TQ3Status            TumblerDocument_UpdateView( DocumentPtr theDocument, TQ3SharedObject viewHints ) ;
  114.  
  115. #ifdef PODIUM_APP
  116. // these functions are needed only for podium
  117. TQ3DrawContextObject TumblerDocument_NewPixmapDrawContext(DocumentPtr theDocument) ;
  118. #endif
  119.  
  120. #endif